home *** CD-ROM | disk | FTP | other *** search
/ Take-Home Tutor en Espanol / TakeHomeTutor.iso / pc / En espanol / Take-Home Tutor 3 / popup_frame.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2003-09-15  |  4.2 KB  |  162 lines

  1. function initializePopUpFrame(sideNav, movies, title)
  2. {
  3.    parent.loadPopUpTitle(title);
  4.    this.scroller.setStyleProperty("background",10053375);
  5.    this.scroller.setScrollContent("dummy");
  6.    parent.loadSideNav(sideNav,movies,this.scroller.getScrollContent());
  7.    this.scroller.refreshPane();
  8. }
  9. function loadSideNav(topics, movieNames, container)
  10. {
  11.    var tempwc = null;
  12.    var tempText = null;
  13.    var i = 0;
  14.    while(i < topics.length)
  15.    {
  16.       container.createEmptyMovieClip("wordClip" + i,i + 100);
  17.       tempwc = container["wordClip" + i];
  18.       tempwc.createTextField("content",10,19.4,73.7,118,0);
  19.       tempText = tempwc.content;
  20.       if(topics[i].indexOf("ETAPA") != -1)
  21.       {
  22.          tempText.embedFonts = true;
  23.          tempText.setNewTextFormat(parent.tfEtapa);
  24.          tempText.autoSize = true;
  25.          tempText.wordWrap = true;
  26.          tempText.selectable = false;
  27.       }
  28.       else
  29.       {
  30.          tempText.embedFonts = true;
  31.          tempText.setNewTextFormat(parent.tf);
  32.          tempText.autoSize = true;
  33.          tempText.wordWrap = true;
  34.       }
  35.       textHeight = tempText._height;
  36.       tempText.text = topics[i];
  37.       if(i == 0)
  38.       {
  39.          tempwc._x = 0;
  40.          tempwc._y = 0;
  41.       }
  42.       else
  43.       {
  44.          tempLastText = container["wordClip" + (i - 1)];
  45.          tempwc._x = 0;
  46.          tempwc._y = tempLastText._y + tempLastText._height + 10;
  47.       }
  48.       tempwc.clip = {};
  49.       tempwc.clip.movieName = movieNames[i];
  50.       tempwc.clip.colorOver = 6697880;
  51.       tempwc.clip.colorOut = 16777215;
  52.       if(topics[i].indexOf("ETAPA") == -1)
  53.       {
  54.          tempwc.onRelease = function()
  55.          {
  56.             trace(this._name + " clicked: " + this.clip.movieName);
  57.             parent.content.loadMovie(this.clip.movieName);
  58.             this.enabled = false;
  59.             parent.lastClicked.enabled = true;
  60.             parent.lastClicked.onRollOut();
  61.             parent.lastClicked = this;
  62.          };
  63.          tempwc.onRollOver = function()
  64.          {
  65.             var clr = new Color(this);
  66.             clr.setRGB(this.clip.colorOver);
  67.          };
  68.          tempwc.onRollOut = function()
  69.          {
  70.             var clr = new Color(this);
  71.             clr.setRGB(this.clip.colorOut);
  72.          };
  73.       }
  74.       if(topics[0].indexOf("ETAPA") != -1 && i == 1)
  75.       {
  76.          tempwc.onRollOver();
  77.          tempwc.enabled = false;
  78.          parent.lastClicked = tempwc;
  79.          parent.loadPopUpContent(tempwc.clip.movieName);
  80.       }
  81.       else if(i == 0)
  82.       {
  83.          tempwc.onRollOver();
  84.          tempwc.enabled = false;
  85.          parent.lastClicked = tempwc;
  86.          parent.loadPopUpContent(tempwc.clip.movieName);
  87.       }
  88.       i++;
  89.    }
  90. }
  91. function loadPopUpTitle(titleText)
  92. {
  93.    parent.createTextField("title",2,13,18,300,20);
  94.    title.text = titleText;
  95.    title.selectable = false;
  96.    title.embedFonts = true;
  97.    title.setTextFormat(parent.tf);
  98. }
  99. function loadPopUpContent(movieName)
  100. {
  101.    parent.createEmptyMovieClip("content",1);
  102.    if(movieName == "glossary.swf")
  103.    {
  104.       content._x = 150;
  105.       content._y = 41;
  106.    }
  107.    else
  108.    {
  109.       content._x = 155;
  110.       content._y = 41;
  111.    }
  112.    content.loadMovie(movieName);
  113. }
  114. stop();
  115. tf = new TextFormat();
  116. tf.font = "Myriad";
  117. tf.color = 16777215;
  118. tf.size = 13;
  119. tfEtapa = new TextFormat();
  120. tfEtapa.font = "Myriad";
  121. tfEtapa.color = 16763904;
  122. tfEtapa.size = 11;
  123. var lastClicked;
  124. parent = this;
  125. this.modalBlocker.hitArea = this;
  126. this.modalBlocker.onPress = function()
  127. {
  128. };
  129. this.modalBlocker.useHandCursor = false;
  130. close.onRollOver = function()
  131. {
  132.    this.gotoAndStop("rollOver");
  133. };
  134. close.onRollOut = function()
  135. {
  136.    this.gotoAndStop("rollOut");
  137. };
  138. close.onReleaseOutside = function()
  139. {
  140.    this.gotoAndStop("rollOut");
  141. };
  142. close.onRelease = function()
  143. {
  144.    parent.unloadMovie();
  145.    _root.enableBottomNav();
  146. };
  147. dragBar.useHandCursor = false;
  148. dragBar.onPress = function()
  149. {
  150.    this._parent.startDrag();
  151.    dragBar.onMouseMove = this.onMouseMoveFunc;
  152. };
  153. dragBar.onRelease = function()
  154. {
  155.    this._parent.stopDrag();
  156.    dragBar.onMouseMove = null;
  157. };
  158. dragBar.onMouseMoveFunc = function()
  159. {
  160.    updateAfterEvent();
  161. };
  162.